package tests;
import com.thoughtworks.selenium.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.util.regex.Pattern;
public class SeleniumTests extends SeleneseTestBase {
	@Before
	public void setUp() throws Exception {
		// setUp("http://www.google.com/",
		// "*C:\\Program Files (x86)\\Internet Explorer\\iexplore.exe");
		selenium = new DefaultSelenium(
				"localhost",
				4444,
				"*firefox C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe",
				"http://localhost:8080/");
		selenium.start();
	}
	@Test
	public void inloggenSuccesvol() throws Exception {
		selenium.open("/to4-hu/index.jsp");
		selenium.click("link=Login");
		selenium.waitForPageToLoad("30000");
		selenium.type("name=email", "piet.hein@mail.com");
		selenium.type("name=wachtwoord", "8272732");
		selenium.click("css=button.btn");
		selenium.waitForPageToLoad("30000");
		verifyTrue(selenium.isTextPresent("U bent nu ingelogd!"));
	}
	@Test
	public void inloggenMislukt() throws Exception {
		selenium.open("/to4-hu/index.jsp");
		selenium.click("link=Login");
		selenium.waitForPageToLoad("30000");
		selenium.type("name=email", "klaas.keesen@mail.com");
		selenium.type("name=wachtwoord", "9383939");
		selenium.click("css=button.btn");
		selenium.waitForPageToLoad("30000");
		verifyTrue(selenium.isTextPresent("Inloggen mislukt"));
	}
	@Test
	public void testTC1_3() throws Exception {
		selenium.open("/to4-hu/");
		selenium.click("link=Login");
		selenium.waitForPageToLoad("30000");
		selenium.type("name=email", "klaas.keesen@mail.com");
		selenium.click("css=button.btn");
		selenium.waitForPageToLoad("30000");
		verifyTrue(selenium.isTextPresent("1 of meerdere velden niet ingevuld"));
	}
	
	
	@After
	public void tearDown() throws Exception {
		selenium.stop();
	}
}
